package com.baize.baizeapp.utils

import android.app.Activity
import android.content.Context

fun Activity.getHeightInPx(): Int {
    return resources.displayMetrics.heightPixels
}

fun Context.getWidthInPx(): Int {
    return resources.displayMetrics.widthPixels
}

fun Context.dip2px(dpValue: Float): Int {
    val scale = resources.displayMetrics.density
    return (dpValue * scale + 0.5f).toInt()
}

fun Context.px2dip(pxValue: Float): Int {
    val scale = resources.displayMetrics.density
    return (pxValue / scale + 0.5f).toInt()
}
